package com.greensam.pixelengine.pojo.vo.space.response;

import cn.hutool.core.bean.BeanUtil;
import com.greensam.pixelengine.pojo.base.BaseDto;
import com.greensam.pixelengine.pojo.entity.SpacePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author Ma Chengrui
 * @since 2025/8/2 14:10
 */
@Getter
@Setter
@Schema(title = "角色信息")
public class SpaceVo extends BaseDto {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(title = "空间id")
    private Long id;

    @Schema(title = "空间名称")
    private String name;

    @Schema(title = "空间描述")
    private String description;

    @Schema(title = "空间等级")
    private Integer level;

    @Schema(title = "空间类型")
    private Integer type;

    @Schema(title = "空间可使用的总大小")
    private Long maxSize;

    @Schema(title = "空间已使用的总大小")
    private Long totalSize;

    @Schema(title = "空间内图片总数")
    private Long totalCount;

    @Schema(title = "空间创建者id")
    private Long createBy;

    @Schema(title = "空间创建时间")
    private LocalDateTime createTime;

    @Schema(title = "空间更新者id")
    private Long updateBy;

    @Schema(title = "空间更新时间")
    private LocalDateTime updateTime;

    /**
     * 空间实体类转封装类
     *
     * @param po 空间实体类
     * @author Ma Chengrui
     * @since 2025/8/2
     */
    public static SpaceVo spacePo2Vo(SpacePo po) {
        if (Objects.isNull(po)) {
            return null;
        }
        return BeanUtil.copyProperties(po, SpaceVo.class);
    }

}
